package com.yuhang.security.validator;

import javax.validation.ConstraintValidator;
import javax.validation.ConstraintValidatorContext;

import org.springframework.beans.factory.annotation.Autowired;

import com.yuhang.security.service.HelloService;

public class MyConstraintValidator implements ConstraintValidator<MyConstaint, Object> {

	@Autowired
	private HelloService helloService;
	
	@Override
	public void initialize(MyConstaint constraintAnnotation) {
		System.out.println("my validator init");
	}

	@Override
	public boolean isValid(Object value, ConstraintValidatorContext context) {

		helloService.greeting("tom");
		System.out.println(value);		
		return false;
	}



}
